package com.fanghuaiming.ml.pay.controller;

import com.fanghuaiming.ml.common.model.enumeration.PayTransactionEnum;
import com.fanghuaiming.ml.pay.controller.dto.MlPayMsgDTO;
import com.fanghuaiming.ml.pay.service.MlPayMsgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/****
 * @description: 支付服务接口
 * @version:1.0.0
 * @author fanghuaiming
 * @data Created in 2020/11/27 下午2:00
 *
 */
@Slf4j
@RestController("pay")
@RequestMapping("/pay")
public class PayController {


    /**
     * 充值service
     */
    @Autowired
    private MlPayMsgService mlPayMsgService;

    /**
     * @Description: 支付
     *
     * @param:
     * @return:
     * @auther: fanghuaiming
     * @date: 2020/12/4 上午11:27
     * @version:1.0.0
     */
    @PostMapping("/pay")
    public PayTransactionEnum payment(@RequestBody MlPayMsgDTO mlPayMsgDTO){
        log.info("====== 请求支付微服务开始 ======");
        PayTransactionEnum payTransactionEnum = mlPayMsgService.pay(mlPayMsgDTO);
        log.info("====== 请求支付微服务成功 ======");
        return  payTransactionEnum;
    }

}
